aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages/sujet/[slug].tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-01-19 15:50:23 +0100
committerArmand Philippot <git@armandphilippot.com>2022-01-19 15:50:23 +0100
commita16d23dcde76874fab4b6bdb45067fd01b88cdc1 (patch)
tree540cfed27a1200ed6bdbc3a445d6dd8a4dc969fb /src/pages/sujet/[slug].tsx
parent1fa8d8281371db25ef9382b6087b7f3c0db73fe3 (diff)
chore: add opengraph and twitter meta
Diffstat (limited to 'src/pages/sujet/[slug].tsx')
-rw-r--r--src/pages/sujet/[slug].tsx14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/pages/sujet/[slug].tsx b/src/pages/sujet/[slug].tsx
index bc87845..6c72cf9 100644
--- a/src/pages/sujet/[slug].tsx
+++ b/src/pages/sujet/[slug].tsx
@@ -52,9 +52,10 @@ const Subject: NextPageWithLayout<SubjectProps> = ({ subject }) => {
dates: subject.dates,
website: subject.officialWebsite,
};
+ const subjectUrl = `${config.url}${router.asPath}`;
const webpageSchema: WebPage = {
- '@id': `${config.url}${router.asPath}`,
+ '@id': `${subjectUrl}`,
'@type': 'WebPage',
breadcrumb: { '@id': `${config.url}/#breadcrumb` },
name: subject.seo.title,
@@ -87,7 +88,7 @@ const Subject: NextPageWithLayout<SubjectProps> = ({ subject }) => {
inLanguage: config.locales.defaultLocale,
isPartOf: { '@id': `${config.url}/blog` },
license: 'https://creativecommons.org/licenses/by-sa/4.0/deed.fr',
- mainEntityOfPage: { '@id': `${config.url}${router.asPath}` },
+ mainEntityOfPage: { '@id': `${subjectUrl}` },
subjectOf: { '@id': `${config.url}/blog` },
};
@@ -101,6 +102,15 @@ const Subject: NextPageWithLayout<SubjectProps> = ({ subject }) => {
<Head>
<title>{subject.seo.title}</title>
<meta name="description" content={subject.seo.metaDesc} />
+ <meta property="og:url" content={`${subjectUrl}`} />
+ <meta property="og:type" content="article" />
+ <meta property="og:title" content={subject.title} />
+ <meta property="og:description" content={subject.intro} />
+ <meta property="og:image" content={subject.featuredImage?.sourceUrl} />
+ <meta
+ property="og:image:alt"
+ content={subject.featuredImage?.altText}
+ />
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }}